<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>vue-ssr</title>
</head>

<body>
  <div id="app">
  </div>

  <script src="../node_modules/vue/dist/vue.js"></script>
  <template id="template">
    <div>
      <h1>App</h1>
      <login :msg="msg"></login>
      <register></register>
    </div>
  </template>
  <script>

    // 定义的组件  Login.vue  和 Register.vue 写在components文件下面  

    // Login.vue  
    const Login = {
      template: '<div>login{{msg}}</div>',
      props: ['msg']
    }

    // Register.vue  
    const Register = {
      template: '<div>Register</div>'
    }

    // 好比如在 App.vue   
    const App = {
      template: '#template',
      data: () => ({
        msg: '父组件的数据'
      }),
      components: {
        // 注册子组件   
        Login,
        Register
      }
    }
    // main.js   
    new Vue({
      el: '#app',
      // components: {
      //   App
      // }
      render: c => c(App)
    })
  </script>
</body>

</html>